from pathlib import Path

from tests.base_test import base_test_case

logger = base_test_case.get_logger(__name__)
TEST_DATA_DIR = base_test_case.test_data_dir
OUTPUT_DATA_DIR = base_test_case.output_data_dir
"""
导出产线配置文件
"""
if __name__ == '__main__':
    input_file = str(TEST_DATA_DIR / "table.jpg")

    import shutil
    from pathlib import Path
    from paddlex.inference.utils.get_pipeline_path import get_pipeline_path

    # 获取PP-StructureV3 (layout_parsing_v2)的配置文件路径
    # source_config_path = get_pipeline_path("layout_parsing_v2")
    # 指定目标路径
    # target_config_path = "./my_project_configs/layout_parsing_v2.yaml"

    source_config_path = get_pipeline_path("PP-StructureV3")
    target_config_path = "./my_project_configs/PP-StructureV3.yaml"

    # 创建目标目录
    Path(target_config_path).parent.mkdir(parents=True, exist_ok=True)

    # 复制配置文件
    shutil.copy2(source_config_path, target_config_path)
    # print(f"PP-StructureV3配置文件已导出到: {target_config_path}")

    # from paddleocr import PaddleOCR, PPStructureV3
    #
    # # 创建目标目录
    # Path("./config").parent.mkdir(parents=True, exist_ok=True)
    # # pipeline = PPStructureV3()
    # PaddleOCR().export_paddlex_config_to_yaml("./config/ocr.yaml")
    # PPStructureV3().export_paddlex_config_to_yaml("./config/PPStructureV3.yaml")
    pass
